<!--
 * @Author: your name
 * @Date: 2021-06-24 10:14:55
 * @LastEditTime: 2021-11-12 15:02:44
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \jinfengts\src\pages\myLaunch\myLaunch.vue
-->

<template>
  <div>
    <!-- 条件筛选展示部分 -->

    <!-- 数据展示部分 -->
    <div class="FeedbackData">
      <div class="aboutOptions">
        <!-- <el-button type="primary" size="small">更新</el-button> -->
        <el-popover placement="bottom-start" width="152" trigger="click">
          <el-checkbox-group v-model="colOptions" :min="3">
            <el-checkbox v-for="item in colSelect" :label="item" :key="item"></el-checkbox>
          </el-checkbox-group>

          <el-button slot="reference" type="primary" size="small" style="margin-left: 10px; margin-bottom: 10px"
            >字段管理</el-button
          >
        </el-popover>
      </div>
      <!-- <el-button type="primary">参数设置</el-button> -->
      <el-table
        height="600"
        :data="commonTableData"
        style="width: 100%"
        ref="tableDataRef"
        class="feedBackDataTable"
        :default-sort="{ prop: 'createdAt', order: 'descending' }"
        :cell-style="{ textAlign: 'center', height: '60px' }"
        :header-cell-style="{
          textAlign: 'center',
          height: '50px',
          backgroundColor: '#FFFFFF'
        }"
      >
        <el-table-column prop="feedBackId" label="反馈ID" v-if="colData[0].istrue" sortable width="90">
          <template slot-scope="scope">
            <span class="toPageLink" @click="getFeedBackDetail(scope.row)">{{ scope.row.feedBackId }}</span>
          </template>
        </el-table-column>

        <el-table-column prop="ctag" label="任务C1/C2标识" v-if="colData[1].istrue">
          <template slot="header">
            <el-tooltip effect="dark" content="创建订单自动生成的编号" placement="top">
              <div slot="content">任务C1/C2标识注释:<br />C1：现场问题分析解决<br />C2：改进/优化</div>
              <span>任务C1/C2标识</span>
            </el-tooltip>
          </template>
          <template slot-scope="scope">
            <span>{{ scope.row.ctag | transferSeverity(ctag) }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="taskNumber" label="任务ID" v-if="colData[2].istrue" sortable width="90">
          <template slot-scope="scope">
            <span v-if="scope.row.readOnly == false" class="toPageLink" @click="getTaskDetail(scope.row)">{{
              scope.row.taskNumber
            }}</span>
            <span v-else class="toPageLink" @click="goToDetaliWithOutBtn(scope.row)">{{ scope.row.taskNumber }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="beyondMarkType" label="超期标识" v-if="colData[3].istrue">
          <template slot="header">
            <el-tooltip effect="dark" placement="top">
              <div slot="content">
                超期标识注释:<br />绿色：未超期<br />蓝色：反馈普通超期<br />橙色：FEMS普通超期<br />红色：严重超期
              </div>
              <span>超期标识</span>
            </el-tooltip>
          </template>
          <template slot-scope="scope">
            <RadioStatusBtn :isClass="true" :type="scope.row.beyondMarkType"> </RadioStatusBtn>
          </template>
        </el-table-column>
        <el-table-column prop="taskType" label="任务类型" v-if="colData[4].istrue">
          <template slot-scope="scope">
            <span v-if="scope.row.taskType === 0">反馈</span>
            <span v-else-if="scope.row.taskType === 1">BUG</span>
            <span v-else>需求</span>
          </template>
        </el-table-column>
        <el-table-column prop="productName" label="所属产品" v-if="colData[5].istrue" width="200">
          <template slot-scope="scope">
            <el-tooltip :content="scope.row.productName" placement="top" effect="light">
              <div class="aboutTitle">{{ scope.row.productName }}</div>
            </el-tooltip>
          </template>
        </el-table-column>
        <el-table-column label="任务主题" v-if="colData[6].istrue" prop="title" width="200">
          <template slot-scope="scope">
            <el-tooltip :content="scope.row.title" placement="top" effect="light">
              <span class="aboutTitle">{{ scope.row.title }}</span>
            </el-tooltip>
          </template>
        </el-table-column>
        <el-table-column width="150" label="计划完成时间" v-if="colData[7].istrue" prop="expectedCompletedDate">
          <!-- <template slot-scope="scope">
            <TaskStatusBtn
              :isClass="true"
              :type="scope.row.c2Status"
              :flowStatusList="C2status"
            ></TaskStatusBtn>
          </template> -->
        </el-table-column>

        <el-table-column prop="lastModifedAt" label="最后更新时间" v-if="colData[8].istrue" width="150">
          <template slot-scope="scope">
            <span>{{ scope.row.lastModifedAt }}</span>
          </template>
        </el-table-column>

        <el-table-column prop="responsibleUserName" label="责任人" v-if="colData[9].istrue"> </el-table-column>
        <el-table-column prop="responsibleUserDep" label="责任人所属部门" v-if="colData[10].istrue"> </el-table-column>
        <el-table-column width="200" prop="meetingName" label="超期反馈会议" v-if="colData[11].istrue">
        </el-table-column>
        <el-table-column prop="c1Status" label="C1状态" v-if="colData[12].istrue">
          <template slot-scope="scope">
            <span>{{ scope.row.c1Status | transferSeverity(taskStatusList) }}</span>
          </template>
        </el-table-column>

        <el-table-column prop="c2Status" label="C2状态" v-if="colData[13].istrue">
          <template slot-scope="scope">
            <span>{{ scope.row.c2Status | transferSeverity(taskStatusList) }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="155" fixed="right">
          <template slot-scope="scope">
            <div class="radioBtnList" v-if="scope.row.readOnly == false">
              <el-tooltip class="item" effect="light" content="持续处理" v-has="'M1102072'" placement="bottom-start">
                <span class="taskRadio seriousDelete" @click="continueDeal(scope.row)"></span>
              </el-tooltip>
              <el-tooltip class="item" effect="light" content="激活" v-has="'M1102062'" placement="bottom-start">
                <span
                  class="taskRadio start"
                  v-show="scope.row.showActivationTag"
                  @click="activeRow(scope.row.taskId)"
                  v-has="'M1104004'"
                ></span>
              </el-tooltip>
              <el-tooltip
                class="item"
                effect="light"
                content="关闭"
                v-has="'M1102063'"
                v-show="scope.row.showCloseTag"
                placement="bottom-start"
              >
                <span class="taskRadio close" @click="closeRow(scope.row)" style="margin-left: 0"></span>
              </el-tooltip>
              <el-tooltip class="item" effect="light" content="转让" v-has="'M1102064'" placement="bottom-start">
                <span class="taskRadio transfer" @click="transferRow(scope.row.taskNumber, scope.row.productId)"></span>
              </el-tooltip>
              <el-tooltip class="item" effect="light" content="确认" v-has="'M1102065'" placement="bottom-start">
                <span
                  v-show="scope.row.showConfirmTag"
                  class="taskRadio confirm"
                  @click="confirm(scope.row.taskNumber)"
                ></span>
              </el-tooltip>
              <el-tooltip class="item" effect="light" content="更新进度" v-has="'M1102066'" placement="bottom-start">
                <span @click="updateRow(scope.row.taskNumber)" class="taskRadio update"></span>
              </el-tooltip>
              <el-tooltip
                class="item"
                effect="light"
                content="申请上会"
                v-has="'M1109006'"
                v-show="scope.row.showApplyMeeting"
                placement="bottom-start"
              >
                <span class="taskRadio apply" @click="application(scope.row)"></span>
              </el-tooltip>
            </div>
          </template>
        </el-table-column>
      </el-table>
    </div>

    <!-- 控制数据展示数量的分页器 -->

    <!-- 创建反馈弹出框 -->
    <!-- <CommonDialog title="创建反馈" width="41.3%" v-bind:dialogVisible="insertDialogVisible" @on-change-dialogVisible="inesertChange" top="4vh"   >
      <template #body>
        <CommonFeedForm></CommonFeedForm>
      </template>
      <template #dialog_footer>
          <el-button @click="canselInsert"    size="small"   >取 消</el-button>
           <el-button @click="saveDraft"    size="small"   >存草稿</el-button>
    <el-button type="primary" @click="insertdialogVisible = false" class="insertReme">发布</el-button>
      </template>
    </CommonDialog> -->
    <!-- 激活弹出框 -->
    <!-- <el-dialog
      title="提示"
      :visible.sync="isactiveDialogVisible"
      width="30%"
      :before-close="handleClose">
      <span>这是一段信息</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="isactiveDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="isactiveDialogVisible = false">确 定</el-button>
      </span>
    </el-dialog> -->

    <!-- 激活弹出框 -->
    <CommonDialog
      title="激活"
      width="75%"
      v-bind:dialogVisible="isactiveDialogVisible"
      @on-change-dialogVisible="activeChange"
      class="startForm"
      top="10vh"
    >
      <template #body>
        <el-form :model="activeForm" label-position="top" ref="activeForm" :rules="activeFormRules" label-width="100">
          <el-form-item label="激活原因" prop="tips">
            <!-- <el-input type="textarea" v-model="activeForm.tips">
            </el-input> -->
            <socialUpload :contentDefault="activeForm.tips" @getContent="getActiveTips"></socialUpload>
          </el-form-item>
        </el-form>
      </template>

      <template #dialog_footer>
        <el-button size="small" @click="activeCancel">取 消</el-button>

        <el-button type="primary" @click="activeConfirm('activeForm')" size="small">确认</el-button>
      </template>
    </CommonDialog>

    <!-- 转让弹出框 -->
    <CommonDialog
      title="转让"
      width="75%"
      v-bind:dialogVisible="transferDialogVisible"
      @on-change-dialogVisible="transferChange"
      class="close"
      top="10vh"
    >
      <template #body>
        <el-form
          :model="transferForm"
          label-position="top"
          ref="transferForm"
          label-width="100"
          :rules="transferFormRules"
        >
          <el-row>
            <el-col :span="24">
              <el-form-item label="接收人" prop="userid">
                <el-select v-model="transferForm.userid">
                  <el-option v-for="item in transferUserList" :key="item.id" :label="item.name" :value="item.id">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="转让原因" prop="reason">
                <!-- <el-input type="textarea" v-model="transferForm.reason">
                </el-input> -->
                <!-- <quill-editor v-model="transferForm.reason" ref="reasonsEditor"> </quill-editor> -->
                <socialUpload :contentDefault="transferForm.reason" @getContent="getTranSferReason"></socialUpload>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </template>

      <template #dialog_footer>
        <el-button size="small" @click="transferCancel">取 消</el-button>

        <el-button type="primary" size="small" @click="confirmtransfer('transferForm')">确认</el-button>
      </template>
    </CommonDialog>

    <!-- 更新进度弹出框 -->
    <CommonDialog
      title="更新进度"
      width="75%"
      v-bind:dialogVisible="updateDialogVisible"
      @on-change-dialogVisible="updateChange"
      class="activeForm"
      top="10vh"
    >
      <template #body>
        <el-form class="suspendForm" :model="updateForm" label-position="top" ref="updateForm" :rules="updateFormRules">
          <el-form-item label="任务详情" class="suspendReason" prop="context">
            <!-- <el-input type="textarea" v-model="updateForm.context">
            </el-input> -->
            <!-- <quill-editor
              v-model="updateForm.context"
              ref="contextEditor"
            >
            </quill-editor> -->
            <socialUpload :contentDefault="updateForm.context" @getContent="getUpdateContent"></socialUpload>
          </el-form-item>
        </el-form>
      </template>

      <template #dialog_footer>
        <el-button size="small" @click="updateCancel">取 消</el-button>

        <el-button type="primary" size="small" @click="confirmUpadte('updateForm')">确认</el-button>
      </template>
    </CommonDialog>

    <!-- 关闭弹出框 -->
    <CommonDialog
      title="关闭"
      width="75%"
      v-bind:dialogVisible="closeDialogVisible"
      @on-change-dialogVisible="closeChange"
      class="close"
      top="10vh"
    >
      <template #body>
        <el-form
          class="closeForm"
          :model="closeForm"
          ref="closeForm"
          :rules="closeFormRules"
          label-width="100"
          label-position="top"
        >
          <el-form-item label="关闭原因" class="closeReason" prop="reason">
            <el-select v-model="closeForm.reason" placeholder="关闭原因">
              <!-- <el-option label="已完成" value="Finish"></el-option>
              <el-option label="取消" value="Cancel"></el-option>
              <el-option label="误操作" value="Misoperation"></el-option>
              <el-option label="其他" value="Other"></el-option> -->
              <el-option
                v-for="(item, index) in closeReasonList"
                :key="index"
                :label="item.text"
                :value="item.id"
              ></el-option>
            </el-select>
          </el-form-item>
          <!-- <el-form-item
            label="解决方案"
            class="closeReason"
            prop="solution"
            :rules="[
              { required: true, message: '请输入解决方案', trigger: 'change' },
            ]"
          >
            <el-input
              type="textarea"
              v-model="closeForm.solution"
              placeholder="请输入解决方案"
            >
            </el-input>
          </el-form-item> -->
          <el-form-item label="备注" class="extra closeReason" prop="remark">
            <!-- <el-input
              type="textarea"
              v-model="closeForm.remark"
              placeholder="请输入备注"
            >
            </el-input> -->
            <!-- <quill-editor v-model="closeForm.remark" ref="remarkReasonEditor"> </quill-editor> -->
            <socialUpload :contentDefault="closeForm.remark" @getContent="getCloseRemark"></socialUpload>
          </el-form-item>
        </el-form>
      </template>

      <template #dialog_footer>
        <el-button size="small" @click="closeCancel">取 消</el-button>

        <el-button type="primary" @click="confirmCloseRow('closeForm')" size="small">确认</el-button>
      </template>
    </CommonDialog>
    <!-- 任务详情弹出框 -->
    <CommonDialog
      title="任务详情"
      width="75%"
      v-bind:dialogVisible="detailDialogVisible"
      @on-change-dialogVisible="detailChange"
      class="details"
      top="10vh"
    >
      <template #body>
        <!-- 评论弹出框 -->
        <el-dialog
          class="insideComment"
          width="30%"
          title="内层 Dialog"
          :visible.sync="innerVisible"
          :show-close="false"
          append-to-body
        >
          <div slot="title" class="dialog-header">
            <div>评论</div>
            <div @click="innerVisible = false">
              <img src="~@/assets/image/Popup_CloseButton.png" alt="closed" />
            </div>
          </div>
          <div style="height: 120px">
            <el-form :model="commentForm" class="el-form closeForm">
              <el-form-item
                label="关闭原因"
                prop="comments"
                class="closeReason"
                :rules="[
                  {
                    required: true,
                    message: '请输入关闭原因',
                    trigger: 'change'
                  }
                ]"
              >
                <el-input type="textarea" v-model="commentForm.comments"></el-input>
              </el-form-item>
            </el-form>
          </div>

          <div slot="footer" class="dialog-footer">
            <el-button class="insertReme" @click="innerVisible = false">关 闭</el-button>
            <el-button size="small" type="primary" @click="innerVisible = false">发布</el-button>
          </div>
        </el-dialog>

        <!-- 关闭任务弹出框 -->
        <el-dialog
          class="insideComment"
          width="58%"
          title="关闭任务"
          :visible.sync="closeTaskVisible"
          :show-close="false"
          append-to-body
        >
          <div slot="title" class="dialog-header">
            <div>关闭任务</div>
            <div @click="closeTaskVisible = false">
              <img src="~@/assets/image/Popup_CloseButton.png" alt="closed" />
            </div>
          </div>
          <div style="height: 320px">
            <el-form :model="closeTaskForm" class="el-form closeForm">
              <el-form-item
                label="关闭原因"
                class="closeReason"
                prop="closeReason"
                :rules="[
                  {
                    required: true,
                    message: '请输入关闭原因',
                    trigger: 'change'
                  }
                ]"
              >
                <el-select v-model="closeTaskForm.closeReason" placeholder="关闭原因">
                  <!-- <el-option label="现场解决" value="xianchang"></el-option>
                    <el-option label="提出方取消" value="tichufang"></el-option>
                    <el-option label="现场临时解决" value="xianchanglinshi"></el-option>
                    <el-option label="其他" value="其他"></el-option> -->
                  <el-option label="请选择关闭原因" value=""></el-option>
                  <el-option label="已完成" value="done"></el-option>
                  <el-option label="取消" value="cancle"></el-option>
                  <el-option label="误操作" value="mistake"></el-option>
                  <el-option label="其他" value="其他"></el-option>
                </el-select>
              </el-form-item>
              <!-- <el-form-item
                label="解决方案"
                class="closeReason"
                prop="closeSolution"
                :rules="[
                  {
                    required: true,
                    message: '请输入解决方案',
                    trigger: 'change',
                  },
                ]"
              >
                <el-input
                  type="textarea"
                  v-model="closeTaskForm.closeSolution"
                  placeholder="请输入解决方案"
                >
                </el-input>
              </el-form-item> -->
              <el-form-item label="备注" class="extra closeReason">
                <el-input type="textarea" v-model="closeTaskForm.extra" placeholder="请输入备注"> </el-input>
              </el-form-item>
            </el-form>
          </div>

          <div slot="footer" class="dialog-footer">
            <el-button class="insertReme" @click="closeTaskVisible = false">关 闭</el-button>
            <el-button size="small" type="primary" @click="closeTaskVisible = false">发布</el-button>
          </div>
        </el-dialog>
        <!-- 更新进度 -->
        <!-- appendToBody -->

        <el-row type="flex" class="row-bg" justify="space-between">
          <el-col :span="12">
            <div class="leftTop">
              <el-form
                ref="form"
                class="detailsForm"
                label-position="left"
                :model="detailsForm"
                label-width="100px"
                size="mini"
              >
                <el-row :gutter="10">
                  <el-col :span="12">
                    <el-form-item label="任务ID">
                      <el-input v-model="detailsForm.id" disabled></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="所属产品">
                      <el-input v-model="detailsForm.productName" disabled></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="10">
                  <el-col :span="12">
                    <el-form-item label="任务状态">
                      <el-input v-model="detailsForm.status" disabled></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="关联反馈ID">
                      <el-input v-model="detailsForm.feedBackId" disabled></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="10">
                  <el-col :span="12">
                    <el-form-item label="任务标识">
                      <el-input v-model="detailsForm.ctag" disabled></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="计划完成时间">
                      <el-input v-model="detailsForm.expectedCompletedDate" disabled></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="10">
                  <el-col :span="12">
                    <el-form-item label="当前责任人">
                      <el-input v-model="detailsForm.responsibleUser" disabled></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="责任人部门">
                      <el-input v-model="detailsForm.responsibleUserDept" disabled></el-input>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="10">
                  <el-col :span="24">
                    <el-form-item label="跟踪事项">
                      <!-- <el-input v-model="detailsForm.trackingTip" :rows="4" type="textarea" disabled></el-input> -->
                      <quill-editor v-model="detailsForm.trackingTip" @focus="focustip($event)"> </quill-editor>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-form>
            </div>
            <div class="leftBottom">
              <el-card class="textCards" shadow="never">
                <ul>
                  <li
                    v-for="(item, index) in taskOperationLogList"
                    :key="index"
                    v-html="'任务进展记录区域:<br>' + (index + 1) + '.' + item.createTime + '&nbsp;' + item.logContent"
                  ></li>
                </ul>
                <!-- 任务进展记录区域：<br> 1.2021/7/8 18：00 张三 添加备注：XX ，修改指派人XXXX<br> 2.20021/7/9 9：00 张三关联了需求<br> -->
              </el-card>
            </div>
          </el-col>
          <el-col :span="11">
            <div class="rightTop">
              <el-card class="textCards2" shadow="never">
                <!-- 任务进展记录区域：<br> 1.2021/7/8 18：00 张三 添加备注：XX ，修改指派人XXXX<br> 2.20021/7/9 9：00 张三关联了需求<br> -->
              </el-card>
            </div>
            <div class="rightBottom">
              <el-card class="textCards" shadow="never">
                任务处理时长信息:<br />
                <el-row>
                  <el-col :span="12">
                    <div>C1环激活次数</div>
                  </el-col>
                  <el-col :span="12">
                    <div>{{ detailsForm.c1ActiveCount }}次</div>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="12">
                    <div>C1环处理总时长</div>
                  </el-col>
                  <el-col :span="12">
                    <div>{{ detailsForm.c1DurationSecond }}秒</div>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="12">
                    <div>C2环激活次数</div>
                  </el-col>
                  <el-col :span="12">
                    <div>{{ detailsForm.c2ActiveCount }}次</div>
                  </el-col>
                </el-row>
                <el-row>
                  <el-col :span="12">
                    <div>C2环处理总时长</div>
                  </el-col>
                  <el-col :span="12">
                    <div>{{ detailsForm.c2DurationSecond }}秒</div>
                  </el-col>
                </el-row>
                <!-- 任务处理时长信息<br> C2环激活次数
                <br> 关闭任务
                <br> 任务处理时长信息 -->
              </el-card>
            </div>
          </el-col>
        </el-row>
      </template>
      <template #dialog_footer>
        <el-button v-show="rowObject.showCloseTag" type="primary" @click="closeRow(rowObject)" size="small"
          >关闭任务</el-button
        >
        <el-button v-show="rowObject.showActivationTag" type="primary" @click="activeRow(rowObject.id)" size="small"
          >激活</el-button
        >
        <el-button
          v-show="rowObject.showAssignTag"
          type="primary"
          @click="transferRow(rowObject.id, rowObject.productId)"
          size="small"
          >转让</el-button
        >
        <el-button v-show="rowObject.showConfirmTag" type="primary" @click="confirm(rowObject.id)" size="small"
          >确认</el-button
        >
        <el-button type="primary" @click="updateRow(rowObject.id)" size="small">更新进度</el-button>
      </template>
    </CommonDialog>

    <!--创建任务弹出框  -->

    <CommonDialog
      title="创建任务"
      width="50%"
      v-bind:dialogVisible="createTaskDialogVisible"
      @on-change-dialogVisible="createTaskChange"
      class="createTask"
      top="3vh"
    >
      <template #body>
        <el-form :rules="rules" :model="createTaskForm" ref="createTaskForm" label-position="top">
          <el-row :gutter="10">
            <el-col :span="12">
              <el-form-item prop="TheirProducts" label="关联ID">
                <el-input
                  v-model="createTaskForm.TheirProducts"
                  placeholder="请输入关联ID"
                  @blur="getProductId"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="10">
            <el-col :span="12">
              <el-form-item prop="taskStatus" label="任务状态">
                <el-select v-model="createTaskForm.taskStatus" placeholder="请选择任务状态">
                  <el-option v-for="item in taskStatusList" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="productName" label="所属产品">
                <el-input v-model="createTaskForm.productName" disabled placeholder="请选择所属产品"> </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="10">
            <el-col :span="12">
              <el-form-item prop="taskIdentity" label="任务标识">
                <el-select v-model="createTaskForm.taskIdentity" placeholder="请选择任务标识">
                  <el-option v-for="item in taskIdentityList" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="closingDate" label="计划完成时间">
                <el-date-picker
                  :clearable="false"
                  :editable="false"
                  type="date"
                  placeholder="请选择截止日期"
                  v-model="createTaskForm.closingDate"
                  style="width: 100%"
                  value-format="yyyy-MM-dd"
                ></el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="10">
            <el-col :span="12">
              <el-form-item prop="currentResponsiblePerson" label="当前责任人">
                <el-select
                  v-model="createTaskForm.currentResponsiblePerson"
                  placeholder="责任人"
                  @change="getPersonDepartment"
                >
                  <el-option v-for="item in insertUserList" :key="item.id" :label="item.name" :value="item.id">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="department" label="责任人部门">
                <el-input v-model="createTaskForm.department" placeholder="请输入责任人部门"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="10">
            <el-col :span="24">
              <el-form-item prop="trackItems" label="跟踪事项">
                <!-- <el-input type="textarea" placeholder="请输入跟踪事项"></el-input> -->
                <quill-editor v-model="createTaskForm.trackItems" ref="trackItemsEditor"> </quill-editor>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </template>

      <template #dialog_footer>
        <el-button size="small" @click="createTaskCancel">取 消</el-button>

        <el-button type="primary" @click="confirmcreateTaskRow('createTaskForm')" size="small">确认</el-button>
      </template>
    </CommonDialog>
    <ApplicationDialog ref="ApplicationDialog" @refreshPage="onSearch" />
    <SeriousDelateDialogTask ref="SeriousDelateDialogTask" @refreshPage="onSearchInfo" />
  </div>
</template>

<script>
import socialUpload from '@/components/socialUpload/socialUpload.vue'
import ApplicationDialog from '@/components/taskApplicationDialog/taskApplicationDialog.vue'
/* 引入通用的状态按钮组件 */
import RadioStatusBtn from '@/components/radioStatusBtn/radioStatusBtn'

/* 引入通用的弹出框 */
import CommonDialog from '@/components/commonDialog/commonDialog.vue'

/* 引用持续处理弹出框 */
import SeriousDelateDialogTask from '@/components/seriousDelateDialogTask/seriousDelateDialogTask.vue'
import FilterTrans from '@/utils/paramsFiler'
import { FeedBack } from '@/api/feedBack/server'
import { taskPandect } from '@/api/tasks/server'

export default {
    name: '',
    components: {
        RadioStatusBtn,
        SeriousDelateDialogTask,
        CommonDialog,
        ApplicationDialog,
        socialUpload
    // CommonFeedForm,
    },
    props: {
        commonTableData: {
            type: Array
        }
    },
    data() {
        const EFilterOprator = FilterTrans.EFilterOprator
        /* 数据标识 */
        return {
            // 数据总数目
            totalNumber: 0,

            // 产品列表
            ProductList: [],

            // 指派人列表
            userList: [],

            // 更新进度指派人列表
            updateUserList: [],
            // 阶段列表
            stageList: [],
            childStageList: [],

            // 创建人物关联责任人
            insertUserList: [],

            // 转让人列表
            transferUserList: [],

            /*  C1/C2标识 */
            ctag: [
                {
                    label: 'C1',
                    value: 0
                },
                {
                    label: 'C2',
                    value: 1
                },
                {
                    label: 'C1/C2',
                    value: 2
                }
            ],

            // 筛选条件
            SelectConditionForm: {
                ctag: '',
                productId: '',
                influenceCategory: '',
                stageId: '',
                assignedUserId: '',
                feedBackNumber: '',
                dateTime: '',
                startTime: '',
                endTime: ''
            },

            searchCondition: [
                {
                    field: 'ctag',
                    operator: EFilterOprator.Equal
                },
                {
                    field: 'productId',
                    operator: EFilterOprator.Equal
                },
                {
                    field: 'influenceCategory',
                    operator: EFilterOprator.Equal
                },
                {
                    field: 'stageId',
                    operator: EFilterOprator.Equal
                },
                {
                    field: 'assignedUserId',
                    operator: EFilterOprator.Equal
                },
                {
                    field: 'feedBackNumber',
                    operator: EFilterOprator.Equal
                }
            ],

            /* 筛选条件未确认 待定 */
            testConditionForm: {},
            textCondition: [],

            queryinfo: {
                pageIndex: 1,
                pageRow: 50
            },

            rules: {
                taskId: [{ required: false, message: '请输入任务ID', trigger: 'change' }],
                taskId2: [{ required: false, message: '请输入关联反馈ID', trigger: 'blur' }],
                feedbackId: [{ required: true, message: '请输入关联反馈ID', trigger: 'change' }],
                feedbackId2: [{ required: false, message: '请输入关联反馈ID', trigger: 'change' }],
                belongProducts: [{ required: true, message: '请选择所属产品', trigger: 'change' }],
                taskStatus: [{ required: true, message: '请选择任务状态', trigger: 'change' }],
                belongProducts2: [{ required: false, message: 'dsfdsffdsadssad', trigger: 'blur' }],
                trackItems: [{ required: true, message: '请填写跟踪事项', trigger: 'change' }],
                taskIdentity: [{ required: true, message: '请选择当任务标识', trigger: 'change' }],
                currentResponsiblePerson: [{ required: true, message: '请选择当前责任人', trigger: 'change' }],
                department: [{ required: false, message: 'dsfdsffdsadssad', trigger: 'blur' }],
                TheirProducts: [{ required: true, message: '请输入关联ID', trigger: 'change' }]
            },
            type: '',
            title: '',
            mainFlowId: '',
            actionType: {
                create: '创建任务',
                update: '更新进度'
            },
            taskIdentityList: [
                {
                    label: 'C1',
                    value: 'C1'
                },
                {
                    label: 'C2',
                    value: 'C2'
                }
            ],
            currentResponsiblePersonList: [
                {
                    label: '姓名1',
                    value: 0
                },
                {
                    label: '姓名2',
                    value: 5
                }
            ],
            theirProductsList: [
                {
                    label: '产品1',
                    value: 0
                },
                {
                    label: '产品2',
                    value: 5
                }
            ],
            taskStatusList: [
                {
                    label: '新建',
                    value: 0
                },
                {
                    label: '处理中',
                    value: 1
                },
                {
                    label: '已完成',
                    value: 2
                }
            ],
            detailsForm: {
                id: '', // 主键
                feedBackId: '', //	关联反馈主键
                productName: '', // 所属产品
                ctag: '', // 任务标识
                expectedCompletedDate: '', // 计划完成时间
                responsibleUser: '', // 责任人
                responsibleUserDept: '', // 责任人部门
                responsibleUserId: '', // 责任人id
                trackingTip: '', // 跟踪事项
                status: '' // 任务状态
            },
            closeTaskForm: {
                closeReason: '',
                closeSolution: '',
                extra: ''
            },
            commentForm: {
                comments: ''
            },
            transForm: {
                person: '',
                comments: ''
            },
            innerVisible: false,
            closeTaskVisible: false,
            // 控制新建弹出框的显示和隐藏
            insertDialogVisible: false,
            // 控制激活弹出框的显示和隐藏
            isactiveDialogVisible: false,

            // 控制终止弹出框的显示和隐藏
            suspendDialogVisible: false,

            // 控制回退弹出框的显示和隐藏
            rebackDialogVisible: false,

            // 控制关闭弹出框的显示和隐藏
            closeDialogVisible: false,

            // 控制详情弹出框的显示和隐藏
            detailDialogVisible: false,

            // 更新进度弹窗
            updateDialogVisible: false,

            // 转让弹出框
            transferDialogVisible: false,

            // 控制创建任务弹出框的显示和隐藏
            createTaskDialogVisible: false,

            // 终止弹出框表单内容
            suspendForm: {
                suspendReason: ''
            },

            // 回退弹出框表单内容
            rebackForm: {
                rebackReason: ''
            },

            // 关闭弹出框表单内容
            closeForm: {
                reason: '',
                remark: '',
                solution: ''
            },
            closeFormRules: {
                reason: [{ required: true, message: '请输入关闭原因', trigger: 'change' }],
                remark: [{ required: false, message: '请输入备注', trigger: 'blur' }]
            },
            // 激活
            activeForm: {
                tips: ''
            },
            activeFormRules: {
                tips: [{ required: true, message: '请输入激活原因', trigger: 'change' }]
            },

            updateForm: {
                context: ''
            },
            updateFormRules: {
                context: [{ required: true, message: '请输入跟踪事项', trigger: 'change' }]
            },
            transferForm: {
                reason: '',
                userid: ''
            },
            transferFormRules: {
                userid: [{ required: true, message: '请选择接收人', trigger: 'change' }],
                reason: [{ required: true, message: '请输入转让原因', trigger: 'blur' }]
            },

            createTaskForm: {
                productId: '',
                productName: '',
                taskStatus: 'New',
                TheirProducts: '',
                taskIdentity: 'C2',
                closingDate: '',
                currentResponsiblePerson: '',
                department: '',
                trackItems: ''
            },

            FeedbackData: [
                {
                    fankuiID: '000',
                    biaoshi: 'C1',
                    renwuID: '1',
                    status: 1,
                    product: 'eww',
                    awayFrom: '产品部',
                    completionTime: '2021-03-20',
                    updatedTime: '2021-04-02',
                    responsible: 'bdsbfv',
                    department: 'A阶段',
                    feedback: '意大利',
                    taskStaus: 0,
                    taskStaus2: 5,
                    productFlowId: '11111111111',
                    Cone: 10
                },
                {
                    fankuiID: '000',
                    biaoshi: 'C1',
                    renwuID: '1',
                    status: 1,
                    product: 'eww',
                    awayFrom: '产品部',
                    completionTime: '2021-03-20',
                    updatedTime: '2021-04-02',
                    responsible: 'bdsbfv',
                    department: 'A阶段',
                    feedback: '意大利',
                    taskStaus: 0,
                    taskStaus2: 5,
                    productFlowId: '11111111111',
                    Cone: 5
                }
            ],

            // 控制表格的列根据选择动态渲染
            colData: [
                { title: '反馈ID', istrue: true },
                { title: 'C1/C2标识', istrue: true },
                { title: '任务ID', istrue: true },
                { title: '超期标识', istrue: true },
                { title: '任务类型', istrue: true },
                { title: '所属产品', istrue: true },
                { title: '任务主题', istrue: true },
                { title: '计划完成时间', istrue: true },
                { title: '最后更新时间', istrue: true },
                { title: '责任人', istrue: true },
                { title: '责任人所属部门', istrue: true },
                { title: '超期反馈会议', istrue: true },
                { title: 'C1状态', istrue: true },
                { title: 'C2状态', istrue: true }
            ],
            colOptions: [],
            colSelect: [],

            // 状态按钮
            flowStatusList: [
                {
                    label: '已关闭',
                    value: 0
                },
                {
                    label: '处理中',
                    value: 5
                },
                {
                    label: '已完成',
                    value: 10
                },
                {
                    label: '已终止',
                    value: 15
                },
                {
                    label: '已过期',
                    value: 20
                }
            ],

            // 优先级
            priorityList: [
                {
                    label: '1级',
                    value: 1
                },
                {
                    label: '2级',
                    value: 2
                },
                {
                    label: '3级',
                    value: 3
                },
                {
                    label: '4级',
                    value: 4
                }
            ],

            // 严重程度
            severityList: [
                {
                    label: '影响现场生产',
                    value: 0
                },
                {
                    label: '影响验收',
                    value: 5
                },
                {
                    label: '影响回款',
                    value: 10
                }
            ],

            taskTableData: [],
            taskCommonId: '',
            rowObject: {},
            taskOperationLogList: [],
            closeReasonList: [],
            setting: {
                branding: false,
                menubar: false,
                toolbar:
          'undo redo | fullscreen | formatselect alignleft aligncenter alignright alignjustify | link unlink | numlist bullist | image media table | fontselect fontsizeselect forecolor backcolor | bold italic underline strikethrough | indent outdent | superscript subscript | removeformat |',
                toolbar_drawer: 'sliding',
                quickbars_selection_toolbar:
          'removeformat | bold italic underline strikethrough | fontsizeselect forecolor backcolor',
                plugins: 'link image  table lists fullscreen',
                language: 'zh_CN',
                init_instance_callback: editor => {
                    if (this.content) {
                        editor.setContent(this.content)
                    }
                    this.finishInit = true
                    editor.on('NodeChange Change SetContent KeyUp', () => {
                        this.hasChanged = true
                    })
                }, // 上传图片
                convert_urls: false,
                automatic_uploads: true, // 开启点击图片上传时，自动进行远程上传操作
                images_upload_base_path: `${process.env.VUE_APP_GOLDWIND_BASE_API}`, // 图片上传的基本路径
                images_upload_url: '/v2/file/upload',
                images_upload_handler: (blobInfo, success, failure) => {
                    var xhr, formData

                    xhr = new XMLHttpRequest()
                    xhr.withCredentials = false
                    xhr.open('POST', `${process.env.VUE_APP_GOLDWIND_BASE_API}` + '/v2/file/upload')
                    xhr.setRequestHeader('token', JSON.parse(sessionStorage.getItem('USERINFO')).token)
                    // xhr.setRequestHeader('token', localStorage.getItem('token'));

                    formData = new FormData()
                    formData.append('file', blobInfo.blob())

                    formData.append('checkOfficeFmt', false)
                    formData.append('isTmp', false)
                    xhr.onload = function(e) {
                        var json
                        console.log(e, xhr)
                        console.log(this)

                        if (xhr.errcode == '0') {
                            failure('服务器错误:' + xhr.msg)
                            return
                        }
                        json = JSON.parse(this.responseText)
                        if (!json.data || typeof json.data.fileSourceId != 'string') {
                            failure('服务器错误')
                            return
                        }
                        success(
                            `${process.env.VUE_APP_GOLDWIND_BASE_API}` +
                '/v2/file/download?' +
                '&fileSourceId=' +
                json.data.fileSourceId
                        )
                    }
                    xhr.send(formData)
                },
                image_advtab: false,
                language_url: 'tinymce/langs/zh_CN.js', // 语言包的路径
                elementpath: false, // 隐藏元素路径，不明白的可以切换true/false观察页面
                statusbar: false,
                resize: false,
                height: 200
            }
        }
    },
    computed: {},

    created() {
    //  创建表格显示项
        var _this = this
        for (let i = 0; i < _this.colData.length; i++) {
            _this.colSelect.push(_this.colData[i].title)
            if (_this.colData[i].title == '责任人所属部门' || _this.colData[i].title == '超期反馈会议') {
                // 初始化不想展示的列可以放在这个条件里
                continue
            }
            _this.colOptions.push(_this.colData[i].title)
        }
    },
    watch: {
    //  监听表格显示项
        colOptions(valArr) {
            var arr = this.colSelect.filter(i => valArr.indexOf(i) < 0) // 未选中
            this.colData.filter(i => {
                if (arr.indexOf(i.title) != -1) {
                    i.istrue = false
                } else {
                    i.istrue = true
                }
            })
            this.$nextTick(() => {
                this.$refs.tableDataRef.doLayout()
            })

            // 将用户的配置习惯保存在本地
            localStorage.setItem('settingList3', JSON.stringify(this.colOptions))
        }
    },

    /* 挂载标识 */
    mounted() {
    // 将用户的配置习惯渲染
        const settingArr = JSON.parse(localStorage.getItem('settingList3'))
        if (settingArr != null) {
            this.colOptions = settingArr
        }

        this.getProductList()
        this.onSearchInfo()
    },

    // 过滤器 用来过滤文字信息
    filters: {
    /**
     * @description:文字过滤器
     * @param {String} _val 传入的值
     * @param {Array} _list 定义的转换数组
     */
        transferSeverity(_val, _list) {
            let str = ''
            _list.findIndex(_item => {
                if (_item.value === _val) {
                    str = _item.label
                    return true
                } else {
                    return false
                }
            })
            return str
        },

        /**
     * @description:字符串长度过滤器
     * @param {String} _val
     * @return {String} 字符串切割后的字符串
     */
        formatData(_val) {
            if (_val) {
                return _val.substring(0, 10)
            }
            return ''
        }
    },

    methods: {
    /**
     * @description: 获取所有产品信息
     */
        async getProductList() {
            try {
                const result = await FeedBack.ProInsertAsync()
                if (result.success) {
                    this.ProductList = result.data
                }
            } catch (err) {
                console.log(err)
            }
        },

        /**
     * @description: 打开创建任务弹出框
     */
        createTask() {
            this.createTaskDialogVisible = true
        },

        /**
     * @description: 获得任务列表数据
     */
        // async GetTaskPageList() {
        //     try {
        //         const data = this.handleForm(this.filter)
        //         const result = await FeedBack.GetPageAsync(data)
        //         if (result.success) {
        //             this.feedBackList = result.data.data
        //             this.totalNumber = result.data.total
        //             console.log(result.data)
        //         }
        //     } catch (err) {
        //         console.log(err)
        //     }
        // },

        /**
     * @description:构建filter实例对象
     * @param {Object} _filter
     * @return {Object} 构建后的filter对象
     */
        handleForm(_filter) {
            const filters = FilterTrans.filterParam(_filter.queryFilter.filters)
            const filter = JSON.parse(JSON.stringify(_filter))
            filter.queryFilter.filters = filters
            filter.pageIndex = this.queryinfo.pageIndex
            filter.pageRow = this.queryinfo.pageRow
            return filter
        },
        /**
     * @description: 获得任务列表数据
     */
        // async getFeedBackList() {
        //     try {
        //         const data = this.handleForm(this.filter)
        //         const result = await taskPandect.GetTaskPageList(data)
        //         if (result.success) {
        //             this.taskTableData = result.data.data
        //             this.totalNumber = result.data.total
        //             console.log('任务总览数据', this.taskTableData)
        //         }
        //     } catch (err) {
        //         console.log(err)
        //     }
        // },
        /**
     * @description:页面加载函数
     */
        onSearch() {
            // this.queryinfo.pageIndex = 1;
            this.tasklist = []
            this.filter = FilterTrans.buildPageRequest(this.testConditionForm, this.textCondition)

            this.getFeedBackList()
        },

        /**
     * @description:导出表格
     */
        exportCharts() {
            this.tasklist = []
            this.filter = FilterTrans.buildPageRequest(this.testConditionForm, this.textCondition)
            this.fileDownload()
        },

        /**
     * @description: 重置表单
     */
        resetForm() {
            this.$nextTick(() => {
                this.$refs['feedbackForm'].resetFields()
            })
        },

        /**
     * @description: 转让
     */
        tranTasks() {
            this.transVisible = true
        },
        /**
     * @description: 关闭任务
     */
        closeTasks() {
            this.closeTaskVisible = true
        },

        canselInsert() {
            this.insertDialogVisible = false
        },
        suspendCancel() {
            this.suspendDialogVisible = false
        },

        rebackCancel() {
            this.rebackDialogVisible = false
        },

        closeCancel() {
            this.closeDialogVisible = false
        },

        detailCancel() {
            this.detailDialogVisible = false
        },
        activeCancel() {
            this.isactiveDialogVisible = false
            this.$refs['activeForm'].resetFields()
        },
        updateCancel() {
            this.updateDialogVisible = false
            this.$refs['updateForm'].resetFields()
        },
        transferCancel() {
            this.transferDialogVisible = false
            this.$refs['transferForm'].resetFields()
        },

        saveDraft() {
            this.suspendDialogVisible = false
        },

        // 从子组件传递过来的状态更新
        inesertChange(val) {
            this.insertDialogVisible = val
        },
        activeRow(val) {
            console.log(val)
            this.taskCommonId = val
            this.isactiveDialogVisible = true
        },

        updateRow(val) {
            console.log(val)
            this.taskCommonId = val
            this.updateDialogVisible = true
        },
        /**
     * @description: 确认任务
     * @param {String} 主键ID
     */
        async confirm(val) {
            try {
                const result = await taskPandect.ConfirmTask(val)
                if (result.success) {
                    this.$message.success('您确认了任务')
                    this.onSearchInfo()
                } else {
                    this.$message.error(result.message)
                }
            } catch (err) {
                console.log(err)
            }
        },

        suspendChange(val) {
            this.suspendDialogVisible = val
        },

        rebackChange(val) {
            this.rebackDialogVisible = val
        },

        closeChange(val) {
            this.closeDialogVisible = val
            this.$refs['closeForm'].resetFields()
        },
        createTaskChange(val) {
            this.createTaskDialogVisible = val
        },
        detailChange(val) {
            this.detailDialogVisible = val
            this.rowObject = {}
        },

        activeChange(val) {
            this.isactiveDialogVisible = val
            this.$refs['activeForm'].resetFields()
        },

        updateChange(val) {
            this.updateDialogVisible = val
            this.$refs['updateForm'].resetFields()
        },

        transferChange(val) {
            this.transferDialogVisible = val
            this.$refs['transferForm'].resetFields()
        },
        /**
     * @description: 监听页面展示条目数变化
     * @param {Number} _val 当前条目数
     */
        handleSizeChange(_val) {
            this.queryinfo.pageRow = _val
            this.onSearchInfo()
        },
        /**
     * @description: 监听页面展示页码数变化
     * @param {Number} _val 当前条目数
     */
        handleCurrentChange(_val) {
            this.queryinfo.pageIndex = _val
            this.onSearchInfo()
        },

        /**
     * @description: 重置筛选条件
     */
        reset() {
            this.$refs['SelectConditionForm'].resetFields()
        },

        /**
     * @description: 关闭任务方法
     * @param {Object} _row 执行关闭方法的当前航对象
     */
        closeRow(_row) {
            this.taskCommonId = _row.taskNumber
            this.closeDialogVisible = true
            this.getcloseReasonList()
        },

        createTaskRow() {
            this.createTaskDialogVisible = true
        },

        /**
     * @description: 确认 关闭任务方法
     * @param {String} formName 关闭任务表单绑定的ref
     */
        confirmCloseRow(formName) {
            this.$refs[formName].validate(async valid => {
                if (valid) {
                    try {
                        const result = await taskPandect.CloseTask(this.closeForm, this.taskCommonId)
                        if (result.success) {
                            this.onSearchInfo()

                            console.log('关闭成功')
                            this.closeDialogVisible = false
                            this.$refs['closeForm'].resetFields()
                        }
                    } catch (err) {
                        console.log(err)
                    }
                } else {
                    return false
                }
            })
        },
        /**
     * @description: 确认 激活任务方法
     * @param {String} formName 激活任务表单绑定的ref
     */
        activeConfirm(formName) {
            this.$refs[formName].validate(async valid => {
                if (valid) {
                    try {
                        const result = await taskPandect.Activation(this.activeForm, this.taskCommonId)
                        if (result.success) {
                            console.log('激活确认成功')
                            this.onSearchInfo()
                            this.activeForm = {
                                tips: ''
                            }
                            this.$refs[formName].resetFields()
                            this.isactiveDialogVisible = false
                        }
                    } catch (err) {
                        console.log(err)
                    }
                } else {
                    console.log('error submit!!')
                    return false
                }
            })
        },

        /**
     * @description: 确认 更新进度方法
     * @param {String} formName 更新进度表单绑定的ref
     */
        confirmUpadte(formName) {
            this.$refs[formName].validate(async valid => {
                if (valid) {
                    console.log('验证通过')
                    try {
                        const result = await taskPandect.UpdateProcess(this.updateForm, this.taskCommonId)
                        if (result.success) {
                            console.log('更新进度成功')
                            this.onSearchInfo()
                            this.updateForm = {
                                context: ''
                            }
                            this.$refs[formName].resetFields()
                            this.updateDialogVisible = false
                        }
                    } catch (err) {
                        console.log(err)
                    }
                } else {
                    console.log('error submit!!')
                    return false
                }
            })
        },

        /**
     * @description: 确认 转让任务方法
     * @param {String} formName 转任务表单绑定的ref
     */
        confirmtransfer(formName) {
            const objparams = {
                reason: this.transferForm.reason
            }
            this.$refs[formName].validate(async valid => {
                if (valid) {
                    console.log(objparams)
                    console.log('验证通过')
                    try {
                        const result = await taskPandect.TransferTask(objparams, this.taskCommonId, this.transferForm.userid)
                        if (result.success) {
                            console.log('转让成功')
                            this.onSearchInfo()
                            this.transferForm = {
                                reason: '',
                                userid: ''
                            }
                            this.transferDialogVisible = false
                            this.$refs[formName].resetFields()
                        }
                    } catch (err) {
                        console.log(err)
                    }
                } else {
                    console.log('error submit!!')
                    return false
                }
            })
        },

        /**
     * @description: 异步下载方法
     */
        async fileDownload() {
            try {
                const data = this.handleForm(this.filter)
                await taskPandect.ExportAsync(data, '任务总览')
            } catch (err) {
                this.$message.error('服务器异常')
            }
        },

        /**
     * @description: 跳转任务详情
     * @param {Object} row 操作的当前航对象
     */
        getTaskDetail(row) {
            console.log(row.taskNumber)
            this.rowObject = row
            // this.detailDialogVisible = true;
            this.queryTaskDetailById(row.taskNumber)
            this.$router.push({
                path: 'taskDetail?id=' + row.taskNumber + '&productId=' + row.productId
            })
        },
        goToDetaliWithOutBtn(row) {
            this.$router.push({
                path: 'taskDetail?id=' + row.taskNumber
            })
        },
        /**
     * @description: 获取任务详情方法
     * @param {String} id 任务ID
     */
        async queryTaskDetailById(id) {
            try {
                const result = await taskPandect.GetInfoByIdAsync(id)

                if (result.success) {
                    this.taskOperationLogList = result.data.taskOperationLogList
                    this.detailsForm = result.data
                    console.log('详情', result.data)
                    console.log('日志详情data', result.data.taskOperationLogList)
                }
            } catch (err) {
                console.log(err)
            }
        },

        /**
     * @description: 获取产品详细信息
     */
        async getProductId() {
            const feedBackId = this.createTaskForm.TheirProducts
            try {
                const result = await taskPandect.GetProductIdByFeedId(feedBackId)
                if (result.success) {
                    console.log('查询成功')
                    this.createTaskForm.productName = result.data.name
                    const prouctId = result.data.id
                    // 根据当前产品ID查询责任人
                    this.insertUserList = []
                    try {
                        const res = await FeedBack.GetListItemAsync({ id: prouctId })

                        if (res.success) {
                            this.insertUserList = res.data
                            console.log('Task_新建责任人', result.data)
                        }
                    } catch (err) {
                        console.log(err)
                    }
                }
            } catch (err) {
                console.log(err)
            }
        },

        /**
     * @description: 获取人员部门
     * @param {String} _val 人员ID
     */
        getPersonDepartment(_val) {
            this.createTaskForm.department = ''
            this.insertUserList.forEach(item => {
                if (item.id == _val) {
                    this.createTaskForm.department = item.department
                }
            })
        },

        /**
     * @description: 获取任务关闭原因列表
     */

        async getcloseReasonList() {
            try {
                const result = await taskPandect.GetTaskCloseReason()
                if (result.success) {
                    this.closeReasonList = result.data
                    console.log('任务关闭原因', result.data)
                }
            } catch (err) {
                console.log(err)
            }
        },

        /**
     * @description: 确认创建任务
     * @param {String} formName 创建任务表单绑定的ref
     */
        confirmcreateTaskRow(formName) {
            this.$refs[formName].validate(async valid => {
                if (valid) {
                    console.log('验证通过')
                    const objparams = {
                        ctag: this.createTaskForm.taskIdentity,
                        expectedCompletedDate: this.createTaskForm.closingDate,
                        feedBackId: this.createTaskForm.TheirProducts,
                        responsibleUser: this.createTaskForm.currentResponsiblePerson,
                        status: this.createTaskForm.taskStatus,
                        trackingTip: this.createTaskForm.trackItems
                    }
                    console.log(objparams)
                    try {
                        const result = await taskPandect.CreateTask(objparams)
                        if (result.success) {
                            console.log('添加任务成功')
                            this.createTaskForm = {
                                productId: '',
                                productName: '',
                                taskStatus: 'New',
                                TheirProducts: '',
                                taskIdentity: '',
                                closingDate: '',
                                currentResponsiblePerson: '',
                                department: '',
                                trackItems: ''
                            }
                            this.onSearchInfo()
                            this.createTaskDialogVisible = false
                            this.$refs[formName].resetFields()
                        }
                    } catch (err) {
                        console.log(err)
                    }
                } else {
                    console.log('error submit!!')
                    return false
                }
            })
        },

        /**
     * @description:取消创建任务方法
     */
        createTaskCancel() {
            this.createTaskForm = {
                productId: '',
                productName: '',
                taskStatus: 'New',
                TheirProducts: '',
                taskIdentity: '',
                closingDate: '',
                currentResponsiblePerson: '',
                department: '',
                trackItems: ''
            }
            this.createTaskDialogVisible = false
        },
        /**
     * @description: 跳转反馈详情
     * @param {*}
     */
        getFeedBackDetail(row) {
            const id = row.fbId
            this.$router.push({
                path: 'Details?id=' + id
            })
        },

        /**
     * @description: 任务转让方法
     * @param {String} id 主键ID
     * @param {String} proid 产品ID
     */
        async transferRow(id, proid) {
            this.taskCommonId = id
            this.transferDialogVisible = true
            this.transferUserList = []
            try {
                const result = await FeedBack.GetListItemAsync({ id: proid })

                if (result.success) {
                    this.transferUserList = result.data
                    console.log('Task_转让责任人', result.data)
                }
            } catch (err) {
                console.log(err)
            }
        },

        /**
     * @description: 任务持续上会
     * @param {Object} row 执行持续上会方法需要的对象
     */
        continueDeal(row) {
            const str = JSON.stringify(row)
            this.$refs.SeriousDelateDialogTask.show(str)
        },
        /**
     * @description: 任务详情传值
     * @param {String} V 传入的编辑框绑定的值
     */
        getUpdateContent(V) {
            this.updateForm.context = V
        },
        /**
     * @description: 转让原因传值
     * @param {String} Value  传入的编辑框绑定的值
     */
        getTranSferReason(Value) {
            this.transferForm.reason = Value
        },
        /**
     * @description: 关闭备注传值
     * @param {String} Value  传入的编辑框绑定的值
     */
        getCloseRemark(Value) {
            this.closeForm.remark = Value
        },
        /**
     * @description: 跟踪事项传值
     * @param {String} Value  传入的编辑框绑定的值
     */
        getCreateTrack(Value) {
            this.createTaskForm.trackItems = Value
        },
        /**
     * @description: 跟踪事项传值
     * @param {String} Value  传入的编辑框绑定的值
     */
        getActiveTips(Value) {
            this.activeForm.tips = Value
        },

        /**
     * @description: 传入子组建页面加载方案
     */
        onSearchInfo() {
            this.$emit('Search')
        },
        /**
     * @description: 申请上会方法
     * @param {Object} row 当前操作行对象
     */
        application(row) {
            const str = JSON.stringify(row)
            this.$refs.ApplicationDialog.show(str)
        }
    }
}
</script>

<style scoped lang="less" src="../../../../../task/task.less"></style>
<style scoped lang="less" src="@/assets/style/taskDIalog.less"></style>
<style scoped lang="less">
.toPageLink {
  color: #3579e0;
  text-decoration: underline;
  &:hover {
    color: #3579e0;
    cursor: pointer;
  }
}
</style>
